﻿/// Write a program that extracts from a given text all dates that match the format DD.MM.YYYY.
/// Display them in the standard date format for Canada.


using System;
using System.Globalization;
using System.Text.RegularExpressions;

class zad19
{
    static void Main()
    {

        string format = "dd.MM.yyyy";

        string text = @"alla bala porokala 10.01.2015 and some more. text and 05.03.2051 
            sdcsdcmkd wed 22.12.2012 csdcdcs 5 2.12.2012";

        foreach (var extracted in Regex.Matches(text, @"\d{2}.\d{2}.\d{4}"))
        {

            string temp = Convert.ToString(extracted);
            DateTime date = DateTime.ParseExact(temp, format, CultureInfo.InvariantCulture);
            Console.WriteLine(date.ToString(CultureInfo.GetCultureInfo("en-CA").DateTimeFormat.ShortDatePattern));
        }
    }

}

